var cartIds = "";
$(function(){
    var subBtn =$('.sub-btn');

    subBtn.on('click', function(){
    	var checkItems = $(".ico_checkbox_on");
    	cartIds = "";
    	checkItems.each(function(i){
    		if($(this).attr("data") != undefined){
    			if(i == 0){
    				cartIds += $(this).attr("data");
    			}else{
    				cartIds += ","+$(this).attr("data");
    			}
    		}
    	});
    	if(cartIds == ""){
    		alert("请选择要购买的商品");
    		return false;
    	}
    	console.log("拼串为"+cartIds);
    	var url = "/order/precartorder?userId="+uid;
    	url = encodeURI(url);
    	console.log("url===="+url);
//        window.location.href = url;
    	document.write("<form action="+url+" method=post name=form1 style='display:none'>");  
    	document.write("<input type=hidden name='cartIds' value='"+cartIds+"'>");  
    	document.write("<input type=hidden name='userId' value='"+uid+"'>");  
    	document.write("</form>");  
    	document.form1.submit();  
    });

})
